package sort;

/**
 * 冒泡排序
 * BubbleSort
 */
public class BubbleSort implements Sort{

	@Override
	public void sort(int[] array) {
        if(array.length == 0){
            return;
        }
        for (int i = 0; i < array.length - 1; i++) {
            for (int j = 1; j < array.length; j++) {
                int tmp =0;
                if(array[j] < array[j-1] ){
                    tmp = array[j-1];
                    array[j-1] = array[j];
                    array[j] = tmp;
                }
            }
        }
    }
}